#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    ui->plainTextEdit->setPlainText("六百六十六");
    connect(ui->clear, SIGNAL(clicked()), this, SLOT(on_clear_clicked()));//第一种连接方式
    connect(ui->xiahuaxian, SIGNAL(clicked(bool)), this, SLOT(on_xiahuaxian_clicked(bool checked)));
    connect(ui->cuti, SIGNAL(clicked(bool)), this, SLOT(on_cuti_clicked(bool checked)));
    connect(ui->xieti, SIGNAL(clicked(bool)), this, SLOT(on_cuti_clicked(bool checked)));
    connect(ui->black, SIGNAL(clicked(bool)), this, SLOT(on_black_clicked(bool checked)));
    connect(ui->red, SIGNAL(clicked(bool)), this, SLOT(on_red_clicked(bool checked)));
    connect(ui->green, SIGNAL(clicked(bool)), this, SLOT(on_green_clicked(bool checked)));
}

Widget::~Widget()
{
    delete ui;

}







void Widget::on_clear_clicked()
{
    ui->plainTextEdit->clear();
}


void Widget::on_makesure_clicked()
{

}


void Widget::on_exit_clicked()
{

}




void Widget::on_xiahuaxian_clicked(bool checked)
{
    QFont font = ui->plainTextEdit->font();
    font.setUnderline(checked);
    ui->plainTextEdit->setFont(font);
}


void Widget::on_xieti_clicked(bool checked)
{
    QFont font = ui->plainTextEdit->font();
    font.setItalic(checked);
    ui->plainTextEdit->setFont(font);
}


void Widget::on_cuti_clicked(bool checked)
{
    QFont font = ui->plainTextEdit->font();
    font.setBold(checked);
    ui->plainTextEdit->setFont(font);
}


void Widget::on_red_clicked(bool checked)
{
    QPalette plet = ui->plainTextEdit->palette();
    plet.setColor(QPalette::Text, Qt::red);
    ui->plainTextEdit->setPalette(plet);
}


void Widget::on_green_clicked(bool checked)
{
    QPalette plet = ui->plainTextEdit->palette();
    plet.setColor(QPalette::Text, Qt::green);
    ui->plainTextEdit->setPalette(plet);
}


void Widget::on_black_clicked(bool checked)
{
    QPalette plet = ui->plainTextEdit->palette();
    plet.setColor(QPalette::Text, Qt::black);
    ui->plainTextEdit->setPalette(plet);
}
